<?php
namespace Common\Common;
class Tree{

	public $tempArr = array();
	//递归数据重组
	public function categoryReform($category,$fid = 0,$num = 0){
		$str = '--';
		$num++;
		$deep = '';
		foreach ($category as $value) {
			if($value['fid'] == $fid){
				if( $num - 1 == 0 ){
					$deep = '顶级分类';
				}else{
					$deep = ($num - 1)."级分类";
				}
				$value['cname'] = str_repeat($str,$num - 1).$value['cname'].("&nbsp;&nbsp;[".$deep."]");
				$this->tempArr[] = $value;
				$this->categoryReform($category,$value['id'],$num);
			}
		}
		return $this->tempArr;
	}

	//晚点写一个无限极回复评论的递归
	public $replyComment = array();


	
}